package 面向对象中级.课堂练习.Exercise04;

public class Teacher extends Person{
    /**
     * (3)声明子类：Teacher类，继承Person类
     * 新增属性：salary薪资，属性私有化，
     * 包含get/set方法
     * 重写getInfo()方法：例如：姓名：张三，年龄：23，性别：男，薪资：10000
     */
    private int salary;

    public Teacher(int salary) {
        this.salary = salary;
    }

    public Teacher(String name, int age, char gender, int salary) {
        super(name, age, gender);
        this.salary = salary;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    @Override
    public void getInfo() {
        System.out.println("姓名："+getName()+" "+"年龄："+getAge()+" "+"性别："+getGender()+" "+"薪资"+getSalary()+" ");
    }
}
